﻿#region << 文件说明 >>

/*----------------------------------------------------------------
 * 命名空间：Vampirewal.Core.Models.FlowEngine
 * 唯一标识：4322a53e-cda4-44ce-a7b0-4e442a73b01f
 * 文件名：FlowUnit
 *
 * 创建者：杨程
 * 电子邮箱：235160615@qq.com
 * 创建时间：2023/10/13 14:50:03
 * 版本：V1.0.0
 * 描述：
 *
 * ----------------------------------------------------------------
 * 修改人：
 * 时间：
 * 修改说明：
 *
 * 版本：V1.0.1
 *----------------------------------------------------------------*/

#endregion << 文件说明 >>



namespace Vampirewal.Core.Models.FlowEngine;

/// <summary>
/// 流程节点
/// </summary>
[SugarTable("Work_FlowUnit", tableDescription: "流程节点表")]
public class FlowUnit : DetailBaseModel
{
    /// <summary>
    /// 是否首节点
    /// </summary>
    [SugarColumn(ColumnDescription = "是否首节点")]
    public bool IsFirst { get; set; }

    /// <summary>
    /// 节点序号
    /// </summary>
    [SugarColumn(ColumnDescription = "节点序号")]
    public int UnitIndex { get; set; }

    /// <summary>
    /// 节点名称
    /// </summary>
    [SugarColumn(ColumnDescription = "节点名称")]
    public string UnitName { get; set; }

    /// <summary>
    /// 描述
    /// </summary>
    [SugarColumn(ColumnDescription = "描述")]
    public string Description { get; set; }

    /// <summary>
    /// 节点类型
    /// </summary>
    [SugarColumn(ColumnDescription = "节点类型")]
    public FlowUnitType UnitType { get; set; }

    /// <summary>
    /// 驳回节点ID
    /// </summary>
    public string RejectUnitId { get; set; }

    /// <summary>
    /// 执行方式
    /// </summary>
    [SugarColumn(ColumnDescription = "执行方式", Length = 50, IsNullable = true)]
    public ExcutionModeType ExcutionMode { get; set; }

    #region 指定人员进行审核
    /// <summary>
    /// 指定执行人ID
    /// </summary>
    [SugarColumn(ColumnDescription = "指定执行人ID", Length = 50, IsNullable = true)]
    public string ExcutorId { get; set; }

    /// <summary>
    /// 指定执行人姓名
    /// </summary>
    [SugarColumn(ColumnDescription = "指定执行人姓名", Length = 50, IsNullable = true)]
    public string ExcutorName { get; set; }

    #endregion

    #region 指定角色的人员进行审核

    /// <summary>
    /// 角色ID
    /// </summary>
    [SugarColumn(ColumnDescription = "角色ID", Length = 50, IsNullable = true)]
    public string RoleId { get; set; }

    /// <summary>
    /// 角色名称
    /// </summary>
    [SugarColumn(ColumnDescription = "角色名称", Length = 50, IsNullable = true)]
    public string RoleName { get; set; }

    #endregion
}

/// <summary>
/// 流程节点状态
/// </summary>
public enum FlowUnitType
{
    /// <summary>
    /// 开始节点
    /// </summary>
    [Description("开始节点")]
    [Display(Name = "开始节点")]
    [SetClassification(Type = 0)]
    Start = 0,

    /// <summary>
    /// 正常节点
    /// </summary>
    [Description("正常节点")]
    [Display(Name = "正常节点")]
    [SetClassification(Type = 1)]
    Normal = 1,

    /// <summary>
    /// 结束节点
    /// </summary>
    [Description("结束节点")]
    [Display(Name = "结束节点")]
    [SetClassification(Type = 1)]
    End = 2
}

/// <summary>
/// 执行方式
/// </summary>
public enum ExcutionModeType
{
    /// <summary>
    /// 指定用户
    /// </summary>
    [Description("指定用户")]
    [Display(Name = "指定用户")]
    [SetClassification(Type = 0)]
    AssignUser =0,
    /// <summary>
    /// 部门负责人
    /// </summary>
    [Description("部门负责人")]
    [Display(Name = "部门负责人")]
    [SetClassification(Type = 1)]
    DepartmentHead=1,
    /// <summary>
    /// 角色
    /// </summary>
    [Description("角色")]
    [Display(Name = "角色")]
    [SetClassification(Type = 2)]
    Role =2,
    /// <summary>
    /// 任意
    /// </summary>
    [Description("任意")]
    [Display(Name = "任意")]
    [SetClassification(Type = 3)]
    EveryOne =3
}